package com.my.mybatis.generator.dao;

import com.my.mybatis.generator.entity.UserUser;
import com.my.mybatis.generator.entity.example.UserUserExample;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserUserMapper {
    int countByExample(UserUserExample example);

    int deleteByExample(UserUserExample example);

    int deleteByPrimaryKey(Integer id);

    @Insert("insert into user_user (name, mobile, sex) values (#{name,typeHandler=com.my.mybatis.typeHandler.MyTypeHandler}, #{mobile}, #{sex})")
    int insert(UserUser record);

    int insertSelective(UserUser record);

    List<UserUser> selectByExample(UserUserExample example);

    @Select("select * from user_user where id = #{id}")
    UserUser selectByPrimaryKey(@Param("id") Integer id);

    @Select("select * from user_user where id = #{id,jdbcType=INTEGER} and name = #{name,jdbcType=VARCHAR}")
    UserUser selectByKeyAndName(@Param("id") Integer id, @Param("name") String name);

    @Select("select * from user_user where name = #{name}")
    UserUser selectByName(String name);

    int updateByExampleSelective(@Param("record") UserUser record, @Param("example") UserUserExample example);

    int updateByExample(@Param("record") UserUser record, @Param("example") UserUserExample example);

    int updateByPrimaryKeySelective(UserUser record);

    int updateByPrimaryKey(UserUser record);

    @Select("select * from user_user")
    List<UserUser> getAll();
}